"""
添加应付款
"""

from page.base_page import BasePage
from selenium.webdriver.common.by import By

class AddYfkPage(BasePage):
    url = "http://192.168.1.25/crm/index.php?m=finance&a=add&t=payables"

    #定位器
    yfk_name_locator = (By.NAME, 'name') #输入应付款名字
    kh_name_locator = (By.NAME, 'customer') #点击客户框
    xzkh_locator = (By.CSS_SELECTOR, 'input[value="3"]') #选择客户
    kh_btn_locator = (By.CSS_SELECTOR,'body > div:nth-child(8) > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div > button:nth-child(1) > span') #点击客户确定
    fkje_locator = (By.NAME, 'price') #输入付款金额
    yfk_bc_btn_locator = (By.NAME, 'submit') #点击保存
    yfk_bcxj_btn_locator =(By.NAME,'submit') #点击保存并新建
    yfk_qx_btn_locator = (By.CSS_SELECTOR,'body > div.container > div.row > div > form > table > tfoot > tr > td:nth-child(2) > input:nth-child(3)') #点击取消

    #操作方法
    #输入应付款名字
    def input_yfk_name(self,yfkname):
        self.driver.find_element(*self.yfk_name_locator).send_keys(yfkname)
    #点击客户框
    def click_kh(self):
        self.driver.find_element(*self.kh_name_locator).click()
    #选择客户
    def click_xzkh(self):
        self.driver.find_element(*self.xzkh_locator).click()
    #确定客户
    def click_kh_btn(self):
        self.driver.find_element(*self.kh_btn_locator).click()
    #输入应付款金额
    def input_fkje(self,fkje):
        self.driver.find_element(*self.fkje_locator).send_keys(fkje)
    #点击保存
    def click_bc_btn(self):
        self.driver.find_element(*self.yfk_bc_btn_locator).click()
    #点击保存并新建
    def click_bcxj_btn(self):
        self.driver.find_element(*self.yfk_bcxj_btn_locator).click()
    #点击取消
    def click_qx_btn(self):
        self.driver.find_element(*self.yfk_qx_btn_locator).click()